/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Felipe Duarte
 */
@Entity
@Table(name = "dato_complementario")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DatoComplementario.findAll", query = "SELECT d FROM DatoComplementario d"),
    @NamedQuery(name = "DatoComplementario.findByIdDatoComplementario", query = "SELECT d FROM DatoComplementario d WHERE d.idDatoComplementario = :idDatoComplementario"),
    @NamedQuery(name = "DatoComplementario.findByNombreDatoComplementario", query = "SELECT d FROM DatoComplementario d WHERE d.nombreDatoComplementario = :nombreDatoComplementario")})
public class DatoComplementario implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_DATO_COMPLEMENTARIO")
    private Integer idDatoComplementario;
    @Size(max = 45)
    @Column(name = "NOMBRE_DATO_COMPLEMENTARIO")
    private String nombreDatoComplementario;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "datoComplementario")
    private List<Direccion> direccionList;

    public DatoComplementario() {
    }

    public DatoComplementario(Integer idDatoComplementario) {
        this.idDatoComplementario = idDatoComplementario;
    }

    public Integer getIdDatoComplementario() {
        return idDatoComplementario;
    }

    public void setIdDatoComplementario(Integer idDatoComplementario) {
        this.idDatoComplementario = idDatoComplementario;
    }

    public String getNombreDatoComplementario() {
        return nombreDatoComplementario;
    }

    public void setNombreDatoComplementario(String nombreDatoComplementario) {
        this.nombreDatoComplementario = nombreDatoComplementario;
    }

    @XmlTransient
    public List<Direccion> getDireccionList() {
        return direccionList;
    }

    public void setDireccionList(List<Direccion> direccionList) {
        this.direccionList = direccionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDatoComplementario != null ? idDatoComplementario.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DatoComplementario)) {
            return false;
        }
        DatoComplementario other = (DatoComplementario) object;
        if ((this.idDatoComplementario == null && other.idDatoComplementario != null) || (this.idDatoComplementario != null && !this.idDatoComplementario.equals(other.idDatoComplementario))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.DatoComplementario[ idDatoComplementario=" + idDatoComplementario + " ]";
    }
    
}
